/* eslint-disable no-shadow */
import _ from "lodash";
// import { getAssociatorLevelInfoByUserID } from "@/api/atms";
import { getUserInfo } from "@/api/usersg";

export const state = () => ({
  userInfo: null,
});

export const mutations = {
  setUserInfo(state, val) {
    state.userInfo = val;
  },
};

export const actions = {
  async getUserInfo({ commit, state }) {
    let userInfo = _.cloneDeep(state.userInfo);
    if (!userInfo) {
      const user = await getUserInfo();
      userInfo = user;
    }
    // userInfo.member = await getAssociatorLevelInfoByUserID(userInfo.CustomerID);
    commit("setUserInfo", userInfo);

    return userInfo;
  },

};
